#ifndef UNIAST_RUNTIME_VARIABLE_H
#define UNIAST_RUNTIME_VARIABLE_H

#include "mlir/IR/Value.h"
#include "type/Type.h"
#include <memory>

namespace UniAST
{

class Variable
{
  private:
    std::shared_ptr<UniAST::Type> varType;
    std::string name;
    mlir::Value allocavalue;

  public:
    bool defined;
    Variable(std::shared_ptr<UniAST::Type> varType, std::string name,
             mlir::Value mlirvalue = nullptr, bool defined = false);
    void setType(std::shared_ptr<UniAST::Type> ty);
    std::shared_ptr<UniAST::Type> getType();
    std::string getName();
    void setValue(mlir::Value mlirvalue);
    mlir::Value getValue();
    static std::shared_ptr<Variable>
    get(std::string name, std::shared_ptr<UniAST::Type> varType = std::make_shared<UniAST::Type>(),
        mlir::Value mlirvalue = nullptr, bool defined = false);
};

} // namespace UniAST

#endif